p_height=3;
p_width=3;

output_name="/Volumes/Data/gSVN/ethernet-switch/paper/figures/speed_evaluation_relative_rate.eps"

my_dir="/Volumes/Data/gSVN/ethernet-switch/paper/plots/speed_evaluation/relative_rate/";

num_switch_filename=paste(my_dir, "num_switch.txt", sep="");
relative_rate_ke_filename=paste(my_dir, "relative_rate_ke.txt", sep="");
relative_rate_sim_time_filename=paste(my_dir, "relative_rate_sim_time.txt", sep="");

middle_relative_rate_sim_time_filename=paste(my_dir, "relative_rate_sim_time_middle.txt", sep="");

num_switch=scan(file=num_switch_filename);
relative_rate_ke=scan(file=relative_rate_ke_filename);
relative_rate_sim_time=scan(file=relative_rate_sim_time_filename);
middle_relative_rate_sim_time=scan(file=middle_relative_rate_sim_time_filename);

#quartz();
postscript(output_name, height=p_height, width=p_width, horizontal=FALSE, onefile=TRUE);

#The four numbers in the call to par are the number of lines of text reserved on the bottom, left, top and right, respectively, ps: text size, mpg: margin size for title, axis label and axis
saved_par=par(mar=c(2.2,2,0.8,0.2)+0.1, ps=8, mgp=c(1.2,0.4,0));

plot(num_switch, relative_rate_ke, col='black', type='b', xlab=NA, ylab=NA,ylim=c(0,1), xlim=c(0, 22), xaxs='i', yaxs='i', cex=0.5);

points(num_switch, relative_rate_sim_time, col='red', pch=19, type='b', cex=0.5);

points(num_switch, relative_rate_ke, col='green', pch=4, type='b', cex=0.5);

points(num_switch, middle_relative_rate_sim_time, col='blue', pch=3, type='b', cex=0.5);

#title(main="Low Load Traffic", ylab=expression(paste("Packet Delay (", mu, "s)", sep="")), xlab="Packet Size (Byte)");
title(main=NA, ylab="Relative Rate", xlab="Number of Switches");

legend('bottomleft', legend=c('Kernel Events Q1/Q3', 'Wall-clock Time Q1/Q3', 'Kernel Events Q2/Q3', 'Wall-clock Time Q2/Q3'), col=c('black', 'red', 'green', 'blue'), pch=c(21,19,4,3), bty='n', cex=c(1, 1, 1, 1));

par(saved_par);

dev.off()